summaryrefslogtreecommitdiff
path: root/src/pages/[locale]/index.astro
diff options
context:
space:
mode:
authorJoe Carstairs <65492573+Sycamost@users.noreply.github.com>2023-08-20 07:57:21 +0100
committerJoe Carstairs <65492573+Sycamost@users.noreply.github.com>2023-08-20 07:57:21 +0100
commit869976b711d862581d1d99bf884dd166b1ecdf3b (patch)
tree966024bf1d14ffbc36d719d51ab8d2b88b5b3f15 /src/pages/[locale]/index.astro
parent863b292304fe130f8a91b191c3b844521ef19ac3 (diff)
Pulls out NewsIndex Astro component
Diffstat (limited to 'src/pages/[locale]/index.astro')
-rw-r--r--src/pages/[locale]/index.astro18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/pages/[locale]/index.astro b/src/pages/[locale]/index.astro
index 11188a0..e5e6040 100644
--- a/src/pages/[locale]/index.astro
+++ b/src/pages/[locale]/index.astro
@@ -5,8 +5,8 @@ import translate from '$i18n/translate';
import tPage from '$i18n/translations/pages/home';
import type Locale from '$types/Locale';
import { getMostRecentNewsItem } from '$lib/newsUtils';
-import NewsPreviewLink from '$components/NewsPreviewLink.astro';
import contactDetails from '$data/contactDetails';
+import NewsIndex from '$components/NewsIndex/NewsIndex.astro';
export async function getStaticPaths() {
return localeStaticPaths;
@@ -20,12 +20,16 @@ const mostRecentNewsItem = await getMostRecentNewsItem(locale);
<Page title={t(tPage, { key: 'title' })}>
<section>
<h2 class="grid-span-6" set:html={t(tPage, { key: 'news' })} />
- {mostRecentNewsItem && <NewsPreviewLink headingLevel="h3" newsItem={mostRecentNewsItem} />}
- <div class="grid-end margin-block-start-sm">
- <a href={`/${locale}/news`} class="btn">
- {t(tPage, { key: 'aw-news' })} ▷
- </a>
- </div>
+ <NewsIndex newsItems={mostRecentNewsItem ? [mostRecentNewsItem] : []} headingLevel="h3" />
+ {
+ mostRecentNewsItem && (
+ <div class="grid-span-2 grid-end margin-block-start-sm">
+ <a href={`/${locale}/news`} class="btn">
+ {t(tPage, { key: 'aw-news' })} ▷
+ </a>
+ </div>
+ )
+ }
</section>
<section>